package com.vonchange.purchase.dr;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.data.provider.Page;
import com.vonchange.headb.core.map.HeaMap;
import com.vonchange.purchase.dr.service.IDRMerchantService;
import com.vonchange.purchase.merchant.bean.Merchant;

/**
 * 单表维护服务类
 * 实现对com.neusoft.race.sys.bean.SysDict对象信息的保存操作
 */
@Component("merchantPR")
public class MerchantAction {
	@Resource
	private IDRMerchantService merchantService;

	@DataProvider
	public void queryMerchant(Page<Merchant> page, Map<String, Object> parameter) {
		if(null==parameter){
			parameter = new HashMap<String, Object>();
		}
		parameter.put("isDelete_eq", 0);
		parameter.put("parentId_eq", 0);
		page=merchantService.findPageDR(page, new HeaMap().setAll(parameter));
	}
	@DataProvider
	public List<Merchant> queryListByParentId(String dictId) {
	    return 	merchantService.findListDR(new HeaMap().set("parentId_eq", dictId).set("isDelete_eq", 0));
	}
	@DataResolver
	public void saveMerchant(Collection<Merchant> datas) throws Exception {	
		merchantService.updateCudDR(datas);
	}

}